package com.sure.supermarketserver.branch.information.dao;

import com.sure.supermarketserver.branch.information.Branch;
import com.sure.supermarketserver.branch.information.BranchDto;
import com.sure.supermarketserver.branch.information.Staff;
import com.sure.supermarketserver.branch.information.StaffDto;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface BranchDao {

    @Select("select br_id,staff.st_id,st_name,st_sex,st_birth,staff_role.ro_id,st_state,st_salary,st_entry,st_tel from staff,staff_role where staff.st_id=staff_role.st_id and br_id=#{br_id}")
    List<Staff> findBrst(StaffDto dto);

    @Select("select br_id, br_name, br_time, br_address from branch")
    List<Branch> findBranchList(BranchDto dto);//查询店面信息

    @Insert("insert into branch (br_id ,br_name ,br_time ,br_address) values(#{br_id},#{br_name},#{br_time},#{br_address})")
    void insertBranch(BranchDto dto);

    @Delete(("delete from branch where br_id=#{id}"))
    void delBranch(String id);

    @Update("update branch set br_id =#{br_id}, br_name =#{br_name}, br_address =#{br_address} where br_id=#{br_id}")
    void updBranch(BranchDto dto);

    @Select("select count(0) from branch where br_id = #{br_Id}")
    boolean findBranch(String br_id);

}
